package cn.arikeky.basic.config;

import cn.arikeky.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor).addPathPatterns("/**").excludePathPatterns(
                // 放行路径
                "/login/**", // 登录相关
                "/verifyCode/**", // 验证码相关
                "/fastDfs/**", // fastDfs相关
                "/shop/settlement", // 店铺入驻相关
                "/user/register/phone/**", // 手机注册相关
                "/user/register/email/**" // 邮箱注册相关
        );
    }
}
